//
//  UIImageView+Extension.swift
//  LXTXShop
//
//  Created by apple on 2018/4/9.
//  Copyright © 2018年 LX. All rights reserved.
//

import UIKit
import Kingfisher

extension UIImageView {
    
    func xh_setImage(_ iamgeUrl:String , _ placeholder:UIImage) -> Void {
        
        var iStr = iamgeUrl
        let leng = iamgeUrl.lengthOfBytes(using: .utf8)
        if leng==0 { iStr = "http://" }
        self.kf.setImage(with: URL.init(string: iStr), placeholder: placeholder, options: nil, progressBlock: nil, completionHandler: nil)
    }
    
    func addTarget(target: Any?, action: Selector, for: UIControlEvents) -> Void {
        let tap = UITapGestureRecognizer.init(target: target, action: action)
        self.isUserInteractionEnabled = true
        self.addGestureRecognizer(tap)
    }
    
}
